﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Utilities.Tests
{
    [TestClass]
    public class UriExtensionTests
    {
        [TestMethod]
        public void ReplaceTopLevelDomainTest()
        {
            // Arrange
            var url = new Uri("http://www.ilseleijten.com/About");

            // Act
            url = url.ReplaceTopLevelDomain("com", "co.uk");

            // Assert
            Assert.AreEqual(url, new Uri("http://www.ilseleijten.co.uk/About"));
        }

        [TestMethod]
        public void ReplaceWrongDomainDoesNothing()
        {
            // Arrange
            var url = new Uri("http://www.ilseleijten.com/About");

            // Act
            url = url.ReplaceTopLevelDomain("nl", "org");

            // Assert
            Assert.AreEqual(url, new Uri("http://www.ilseleijten.com/About"));
        }
    }
}
